package com.xy.configs;

import com.xy.novelmanagement.websocket.BQGSocket;
import org.springframework.context.annotation.Bean;
import org.springframework.context.annotation.Configuration;
import org.springframework.scheduling.concurrent.ThreadPoolTaskScheduler;
import org.springframework.web.socket.config.annotation.EnableWebSocket;
import org.springframework.web.socket.config.annotation.WebSocketConfigurer;
import org.springframework.web.socket.config.annotation.WebSocketHandlerRegistry;

@Configuration
@EnableWebSocket
public class WebsocketConfig  implements WebSocketConfigurer {

		@Override
		public void registerWebSocketHandlers(WebSocketHandlerRegistry webSocketHandlerRegistry) {
				webSocketHandlerRegistry.addHandler(new BQGSocket(), "/bqg").setAllowedOrigins("*");
		}

		@Bean
		public ThreadPoolTaskScheduler threadPoolTaskScheduler() {
				return new ThreadPoolTaskScheduler();
		}
}